package com.hdey.controller.chao;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hdey.pojo.chao.Chukuzi;
import com.hdey.service.chao.ChukuziService;
import com.hdey.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

@RestController
@RequestMapping("/ckz")
@Slf4j
public class ChukuziController {

        @Resource
        private ChukuziService chukuziService;


        private String msg;

        @GetMapping("/index")
        public ModelAndView index(){

            return new ModelAndView("chao/chuku");

        }
//        // 添加
//        @RequestMapping("/add")
//        public Result add(Wuzi wuzi) {
//                System.out.println(wuzi);
//                wuzi.setCreateDate(LocalDate.now());
//                boolean flag = wuziService.save(wuzi);
//                return flag ? Result.success("添加成功") : Result.fail("添加失败");
//        }

        @RequestMapping("/search")
        @ResponseBody
        public Result search(Integer page, Integer limit, String outstorageMasterNo){
                System.out.println(outstorageMasterNo);
                Page<Chukuzi> chukuziPage = chukuziService.searchPage(page, limit, outstorageMasterNo);
                System.out.println(chukuziPage.getRecords());
                return Result.success(chukuziPage);
        }







}
